package embeded.impl;

import java.rmi.RemoteException;

import client.RemoteParticipant;

import topic.Topic;
import data.DataObject;
import embeded.Participant;

public class ParticipantImpl implements Participant {
	private Topic topic = null;
	private String name = null;
	private RemoteParticipant remote = null;

	public ParticipantImpl(String name, Topic topic) throws RemoteException {
		this.topic = topic;
		this.name = name;
	}

	public String getName() throws RemoteException {
		return name;
	}

	public Topic getTopic() throws RemoteException {
		return topic;
	}

	public void setData(DataObject data) throws RemoteException {
		topic.setDataObject(data);
	}

	public DataObject getData() throws RemoteException {
		return topic.getDataObject();
	}

	public void setRemote(RemoteParticipant remote) throws RemoteException {
		this.remote = remote;
	}

	public void refresh() {
		try {
			remote.refreshParticipantUser();
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}
}
